﻿
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace QPlcPlayer.Services
{
    public class QMainService
    {

        private static Lazy<string> dbConnectionString = new Lazy<string>(() =>
        {
            if(!string.IsNullOrWhiteSpace( AppRuntime.DbConnectionString))return AppRuntime.DbConnectionString;
           var conn= ConfigurationManager.AppSettings.Get("ConnectionString");         
            return conn;
        });
        protected SqlServerDbContext CreateDbContext()
        {
            var db=new SqlServerDbContext(dbConnectionString.Value);
            return db;
        }

    }
}
